<link rel="stylesheet" href="{$ABS_PATH}admin/codemirror/lib/codemirror.css">

<script src="{$ABS_PATH}admin/codemirror/lib/codemirror.js" type="text/javascript"></script>
    <script src="{$ABS_PATH}admin/codemirror/mode/xml/xml.js"></script>
    <script src="{$ABS_PATH}admin/codemirror/mode/javascript/javascript.js"></script>
    <script src="{$ABS_PATH}admin/codemirror/mode/css/css.js"></script>
    <script src="{$ABS_PATH}admin/codemirror/mode/clike/clike.js"></script>
    <script src="{$ABS_PATH}admin/codemirror/mode/php/php.js"></script>

{literal}
    <style type="text/css">
      .activeline {background: #e8f2ff !important;}
      /*.CodeMirror-scroll {height: 300px;}*/
      .CodeMirror-scroll {
        height: auto;
        min-height:240px;
/*
        overflow-y: hidden;
        overflow-x: auto;
*/
      }
      .tableStatic td {
      vertical-align: top;
      }
    </style>
{/literal}


    
<script type="text/javascript">
function openFileWindow(target,id,document_alias) {ldelim}
	if (typeof width=='undefined' || width=='') var width = screen.width * 0.6;
	if (typeof height=='undefined' || height=='') var height = screen.height * 0.6;
	if (typeof doc=='undefined') var doc = 'Title';
	if (typeof scrollbar=='undefined') var scrollbar=1;
	var left = ( screen.width - width ) / 2;
	var top = ( screen.height - height ) / 2;
	window.open('browser.php?id='+id+'&typ=bild&mode=fck&target=navi&cp={$sess}','pop','left='+left+',top='+top+',width='+width+',height='+height+',scrollbars='+scrollbar+',resizable=1');
{rdelim}


$(document).ready(function() {ldelim}

	$('#poll_start').datetimepicker({ldelim}
		changeMonth: true,
        changeYear: true,
		timeOnlyTitle: 'Выберите время',
		timeText: 'Время',
		hourText: 'Часы',
		minuteText: 'Минуты',
		secondText: 'Секунды',
		currentText: 'Теперь',
		closeText: 'Закрыть',

		onClose: function(dateText, inst) {ldelim}
        var endDateTextBox = $('#poll_stop');
        if (endDateTextBox.val() != '') {ldelim}
            var testStartDate = new Date(dateText);
            var testEndDate = new Date(endDateTextBox.val());
            if (testStartDate > testEndDate)
                endDateTextBox.val(dateText);
        {rdelim}
        else {ldelim}
            endDateTextBox.val(dateText);
        {rdelim}
	    {rdelim},
	    onSelect: function (selectedDateTime){ldelim}
	        var start = $(this).datetimepicker('getDate');
	        $('#poll_stop').datetimepicker('option', 'minDate', new Date(start.getTime()));
	    {rdelim}
	{rdelim});


	$('#poll_stop').datetimepicker({ldelim}
		changeMonth: true,
        changeYear: true,
		timeOnlyTitle: 'Выберите время',
		timeText: 'Время',
		hourText: 'Часы',
		minuteText: 'Минуты',
		secondText: 'Секунды',
		currentText: 'Теперь',
		closeText: 'Закрыть',

		onClose: function(dateText, inst) {ldelim}
        var startDateTextBox = $('#poll_start');
        if (startDateTextBox.val() != '') {ldelim}
            var testStartDate = new Date(startDateTextBox.val());
            var testEndDate = new Date(dateText);
            if (testStartDate > testEndDate)
                startDateTextBox.val(dateText);
        {rdelim}
        else {ldelim}
            startDateTextBox.val(dateText);
        {rdelim}
    {rdelim},
    onSelect: function (selectedDateTime){ldelim}
        var end = $(this).datetimepicker('getDate');
        $('#poll_start').datetimepicker('option', 'maxDate', new Date(end.getTime()) );
    {rdelim}
	{rdelim});

editor.refresh();
editor2.refresh();

{rdelim});
</script>





<div class="title"><h5>{#POLL_EDIT#}</h5></div>
<div class="widget" style="margin-top: 0px;">
    <div class="body">{#POLL_EDIT_INFO#}</div>
</div>

<div class="breadCrumbHolder module">
	<div class="breadCrumb module">
	    <ul>
	        <li class="firstB"><a href="index.php" title="{#MAIN_PAGE#}">{#MAIN_PAGE#}</a></li>
	        <li><a href="index.php?do=modules&amp;cp={$sess}">{#MODULES_SUB_TITLE#}</a></li>
	        <li><a href="index.php?do=modules&action=modedit&mod=poll&moduleaction=1&cp={$sess}">Опросы</a></li> 
	        <li>{$row->poll_title}</li>
	    </ul>
	</div>
</div>



<div class="widget first">

	<ul class="tabs">
	    <li class="activeTab"><a href="#tab1">Данные опроса</a></li>
	    <li class=""><a href="#tab2">Редактирование вариантов ответов</a></li>
	    <li class=""><a href="#tab3">Новый ответ</a></li>
	    <li class=""><a href="#tab4">Шаблон вывода опроса</a></li>
	</ul>
	
	<div class="tab_container">

		<div id="tab1" class="tab_content" style="display: block;">
			<form method="post" action="{$formaction1}" class="mainForm">
			<div class="hash"></div>
			<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
				<col width="200">
				<tr>
					<td class="first">Вопрос:</td>
					<td class="second">
						<div class="pr12">
						<textarea class="expand" rows="1"  style="width:100%" id="poll_name" name="poll_name">{$row->poll_title}</textarea>
						</div>
					</td>
				</tr>
				<tr>
					<td class="first">{#POLL_STATUS#}?</td>
					<td class="second">
			
						<div class="pr12">
			            <input id="poll_status1" type="radio" name="poll_status" value="1" {if $row->poll_status==1}checked{/if}/>
			            <label>{#POLL_YES#}</label>           
			            
			            <input id="poll_status2" type="radio" name="poll_status" value="0" {if $row->poll_status!=1}checked{/if}/>
			            <label>{#POLL_NO#}</label>
						
						</div>			
						
						
					</td>
				</tr>
				<tr>
					<td class="first">{#POLL_CAN_COMMENT#}</td>
					<td class="second">
						
						<div class="pr12">
			            <input id="poll_can_comment1" type="radio" name="poll_can_comment" value="1" {if $row->poll_can_comment==1}checked{/if}/>
			            <label>{#POLL_YES#}</label>           
			            
			            <input id="poll_can_comment2" type="radio" name="poll_can_comment" value="0" {if $row->poll_can_comment!=1}checked{/if}/>
			            <label>{#POLL_NO#}</label>
						
						</div>
						
						
					</td>
				</tr>
				<tr>
					<td valign="top" class="first">Разрешить показывать результаты</td>
					<td class="second">
						<div class="pr12">
			            <input id="show_result1" type="radio" name="show_result" value="1" {if $row->poll_show_result==1}checked{/if}/>
			            <label>{#POLL_YES#}</label>           
			            
			            <input id="show_result2" type="radio" name="show_result" value="0" {if $row->poll_show_result!=1}checked{/if}/>
			            <label>{#POLL_NO#}</label>
						
						</div>
					</td>
				</tr>				
				<tr>
					<td class="first">{#POLL_START_TIME#}</td>
					<td class="second">
						<input id="poll_start" name="poll_start" type="text" value="{$row->poll_start|date_format:"%d.%m.%Y %H:%M"}"  style="width: 150px;"/>	
					</td>
				</tr>
				<tr>
					<td class="first">{#POLL_END_TIME#}</td>
					<td class="second">
						<input id="poll_stop" name="poll_stop" type="text" value="{$row->poll_end|date_format:"%d.%m.%Y %H:%M"}"  style="width: 150px;"/>	
					</td>
				</tr>
				<tr>
					<td valign="top" class="first">{#POLL_USER_GROUPS#}<br /><small>{#POLL_GROUP_INFO#}</small></td>
					<td class="second">
						<select style="width:200px"  name="groups[]" size="5" multiple="multiple">
							{html_options options=$groups selected=$selected}
						</select>
					</td>
				</tr>

					<tr>
						<td class="second" colspan="2"><input type="submit" class="basicBtn topDir" value="{#POLL_BUTTON_SAVE#}" /></td>
					</tr>
			
			</table>
			</form>
		</div>







		<div id="tab2" class="tab_content" style="display: none;">
			<form method="post" action="{$formaction2}" class="mainForm">
			<div class="hash"></div>
				{if $smarty.request.id != ''}
					<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
						<thead>
						<tr>
							<td align="center" width="1%"></td>
							<td>Вариант ответа</td>
							<td>Изображение</td>
							<td>{#POLL_QUESTION_COLOR#}</td>
							<td>{#POLL_QUESTION_POSI#}</td>
							<td>{#POLL_QUESTION_HITS#}</td>
						</tr>
						</thead>
						{foreach from=$items item=item}
							<tr>
								<td width="1%">
									
								<input title="{#POLL_MARK_DELETE#}" name="del[{$item->id}]" type="checkbox" id="del[{$item->id}]" value="1" />
									</td>
								<td width="30%">
								
<div class="pr12"><textarea class="expand" rows="1"  style="width:100%" id="item_title[{$item->id}]" name="item_title[{$item->id}]">{$item->poll_item_title}</textarea></div>					
								</td>
								<td>
								
<a href="{$item->image}" target="_blank"><img border='0' align='left' alt='' width="80" id="preview__item_image_{$item->id}" src='{$item->poll_item_image}' style='padding: 2px 2px 0pt 0px;'></a>
<div class="clear" style="height:5px"></div>
								
								
<input name="item_image[{$item->id}]" type="text" id="item_image_{$item->id}" value="{$item->poll_item_image}" style="width:75%"/> <input value="..." title="{#NAVI_LINK_IMGTL#}" class="basicBtn topDir" onclick="openFileWindow('item_image_{$item->id}','item_image_{$item->id}');" type="button">								
								
								
								
								
								</td>
								<td width="20%">
									<div class="pr12">
									<input readonly="readonly" style="width:100px" id="color_{$item->id}" name="line_color[{$item->id}]" type="text" value="{$item->poll_item_color}" class="iColorPicker" />
									</div>
								</td>
								<td width="5%"><input style="width:40px" name="position[{$item->id}]" type="text" id="position[{$item->id}]" size="5" maxlength="3" value="{$item->poll_item_position}" /></td>
								<td width="5%"><input style="width:40px" name="poll_item_hits[{$item->id}]" type="text" id="poll_item_hits[{$item->id}]" value="{$item->poll_item_hits}" /></td>
							</tr>
						{/foreach}
			
						<tr class="second">
							<td colspan="6"><input type="submit" class="basicBtn topDir" value="{#POLL_BUTTON_SAVE#}" /></td>
						</tr>
					</table>
				{/if}
			</form>
		</div>










		<div id="tab3" class="tab_content" style="display: none;">

		{if $smarty.request.id != ''}
			<form method="post" action="index.php?do=modules&action=modedit&mod=poll&moduleaction=save_new&cp={$sess}&id={$smarty.request.id|escape}" name="new" class="mainForm">
				<div class="hash"></div>
				<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
				<thead>
					<tr class="tableheader">
						<td>Вариант ответа</td>
						<td>Изображение</td>
						<td>{#POLL_QUESTION_COLOR#} </td>
						<td>{#POLL_QUESTION_POSI#}</td>
						<td>{#POLL_QUESTION_HITS#}</td>
					</tr>
				</thead>
					<tr class="first">
						<td width="30%">
						<div class="pr12"><textarea class="expand" rows="1"  style="width:100%" id="item_title" name="item_title"></textarea></div>
						<td>
							<a href="{$item->image}" target="_blank"><img border='0' align='left' alt='' width="80" id="preview__item_image" src='' style='padding: 2px 2px 0pt 0px;'></a>
							<div class="clear" style="height:5px"></div>
															
															
							<input name="item_image" type="text" id="item_image" value="" style="width:75%"/> <input value="..." title="{#NAVI_LINK_IMGTL#}" class="basicBtn topDir" onclick="openFileWindow('item_image','item_image');" type="button">								
	
						</td>
						<td width="20%">
							<div class="pr12">
								<input readonly="readonly" style="width:100px" id="color1" name="line_color" type="text" value="" class="iColorPicker" />
							</div>
						</td>
						<td width="5%"><div class="pr12"><input style="width:40px" name="position" type="text" id="position" size="5" maxlength="3" value="" /></div></td>
						<td width="5%"><div class="pr12"><input style="width:40px" name="poll_item_hits" type="text" id="poll_item_hits" value="" /></div></td>
					</tr>
		
					<tr class="second">
						<td colspan="5"><input type="submit" class="basicBtn topDir" value="{#POLL_BUTTON_ADD#}" /></td>
					</tr>
				</table>
			</form>
		{/if}
		</div>
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
<div id="tab4" class="tab_content" style="display: block;">	
	<form method="post" action="{$formaction3}" class="mainForm">
		<div class="hash"></div>	

		<div class="head"><h5 class="iFrames">Подключаемые скрипты (настраиваемый тип вывода)</h5></div>
			

			
<!--
			{literal}
			    <style type="text/css">
			      .activeline {background: #e8f2ff !important;}
			      .CodeMirror-scroll {height: 200px;}
			    </style>
			{/literal}
-->


			
			<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
			<col width="250">
			<col>
			    <thead>
			    <tr>
			        <td>{#GalleryScriptsTag#}</td>
			        <td>Подключаемые скрипты (настраиваемый тип вывода)</td>
			    </tr>
			    </thead>
			    <tbody>
			    <tr>
			        <td><strong><a class="rightDir" title="{#GalleryTagId#}" href="javascript:void(0);" onclick="textSelection('[tag:poll:id]', '');">[tag:poll:id]</a></strong></td>
			        <td rowspan="8"><textarea name="poll_script" cols="80" rows="10" id="poll_script" style="width:100%">{$row->poll_script|escape}</textarea></td>
			    </tr>

			    <tr>
			        <td>
			            <strong><a class="rightDir" title="" href="javascript:void(0);" onclick="textSelection('[tag:poll:title]', '');">[tag:poll:title]</a></strong>
			        </td>
			    </tr>
				<tr>
				    <td>
				        <strong><a class="rightDir" title="" href="javascript:void(0);" onclick="textSelection('[tag:poll:item]', '');">[tag:poll:item]</a></strong>
				    </td>
				</tr>    
			    <tr>
			        <td>
			            <strong><a class="rightDir" title="" href="javascript:void(0);" onclick="textSelection('[tag:poll:datestart][d.m.Y]', '');">[tag:poll:datestart]</a></strong>
			        </td>
			    </tr>
			    <tr>
			        <td>
			            <strong><a class="rightDir" title="" href="javascript:void(0);" onclick="textSelection('[tag:poll:dateend][d.m.Y]', '');">[tag:poll:dateend]</a></strong>
			        </td>
			    </tr>			    
			    <tr>
			        <td>
			            <strong><a class="rightDir" title="" href="javascript:void(0);" onclick="textSelection('[tag:poll:form]', '');">[tag:poll:form]</a></strong>
			        </td>
			    </tr>			    
			    <tr>
			        <td>
			            <strong><a class="rightDir" title="" href="javascript:void(0);" onclick="textSelection('[tag:poll:submit]', '');">[tag:poll:submit]</a></strong>
			        </td>
			    </tr>			    
			    <tr>
			        <td>
			            <strong><a class="rightDir" title="" href="javascript:void(0);" onclick="textSelection('[tag:poll:result]', '');">[tag:poll:result]</a></strong>
			        </td>
			    </tr>

			            <tr>
			                <td>{#GalleryTags#}</td>
			                <td>
			        |&nbsp;
			        <a href="javascript:void(0);" onclick="textSelection('<ol>', '</ol>');"><strong>OL</strong></a>&nbsp;|&nbsp;
			        <a href="javascript:void(0);" onclick="textSelection('<ul>', '</ul>');"><strong>UL</strong></a>&nbsp;|&nbsp;
			        <a href="javascript:void(0);" onclick="textSelection('<li>', '</li>');"><strong>LI</strong></a>&nbsp;|&nbsp;
					<a href="javascript:void(0);" onclick="textSelection('<p class=&quot;&quot;>', '</p>');"><strong>P</strong></a>&nbsp;|&nbsp;
					<a href="javascript:void(0);" onclick="textSelection('<strong>', '</strong>');"><strong>B</strong></a>&nbsp;|&nbsp;
					<a href="javascript:void(0);" onclick="textSelection('<em>', '</em>');"><strong>I</strong></a>&nbsp;|&nbsp;
					<a href="javascript:void(0);" onclick="textSelection('<h1>', '</h1>');"><strong>H1</strong></a>&nbsp;|&nbsp;
					<a href="javascript:void(0);" onclick="textSelection('<h2>', '</h2>');"><strong>H2</strong></a>&nbsp;|&nbsp;
					<a href="javascript:void(0);" onclick="textSelection('<h3>', '</h3>');"><strong>H3</strong></a>&nbsp;|&nbsp;
					<a href="javascript:void(0);" onclick="textSelection('<h4>', '</h4>');"><strong>H4</strong></a>&nbsp;|&nbsp;
					<a href="javascript:void(0);" onclick="textSelection('<h5>', '</h5>');"><strong>H5</strong></a>&nbsp;|&nbsp;
					<a href="javascript:void(0);" onclick="textSelection('<div class=&quot;&quot; id=&quot;&quot;>', '</div>');"><strong>DIV</strong></a>&nbsp;|&nbsp;
					<a href="javascript:void(0);" onclick="textSelection('<a href=&quot;&quot; title=&quot;&quot;>', '</a>');"><strong>A</strong></a>&nbsp;|&nbsp;
					<a href="javascript:void(0);" onclick="textSelection('<img src=&quot;&quot; alt=&quot;&quot; />', '');"><strong>IMG</strong></a>&nbsp;|&nbsp;
					<a href="javascript:void(0);" onclick="textSelection('<span>', '</span>');"><strong>SPAN</strong></a>&nbsp;|&nbsp;
					<a href="javascript:void(0);" onclick="textSelection('<pre>', '</pre>');"><strong>PRE</strong></a>&nbsp;|&nbsp;
					<a href="javascript:void(0);" onclick="textSelection('<br />', '');"><strong>BR</strong></a>&nbsp;|&nbsp;
					<a href="javascript:void(0);" onclick="textSelection('\t', '');"><strong>TAB</strong></a>&nbsp;|
			                 </td>
			            </tr>
			    </tbody>
			</table>
		



	
	
		
		<div class="head"><h5 class="iFrames">Шаблон вариантов ответов (настраиваемый тип вывода)</h5></div>
		
		<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
		<col width="250">
		<col>
		    <thead>
		    <tr>
		        <td>{#ImageTplTag#}</td>
		        <td>Шаблон вариантов ответов (настраиваемый тип вывода)</td>
		    </tr>
		    </thead>
		    <tbody>
					<tr>
						<td><strong><a class="rightDir" title="" href="javascript:void(0);" onclick="textSelection2('[tag:item:id]', '');">[tag:item:id]</a></strong></td>
		                <td rowspan="7"><textarea name="poll_items" cols="80" rows="10" id="poll_items" style="width:100%">{$row->poll_items|escape}</textarea></td>
					</tr>
		
		
					<tr>
						<td><strong><a class="rightDir" title="" href="javascript:void(0);" onclick="textSelection2('[tag:item:title]', '');">[tag:item:title]</a></strong></td>
					</tr>
		
		
					<tr>
						<td><strong><a class="rightDir" title="" href="javascript:void(0);" onclick="textSelection2('[tag:item:color]', '');">[tag:item:color]</a></strong></td>
					</tr>
					
					 <tr>
					    <td>
					        <strong><a class="rightDir" title="" href="javascript:void(0);" onclick="textSelection2('[tag:item:hit]', '');">[tag:item:hit]</a></strong>
					    </td>
					</tr>
						
					<tr>
						<td><strong><a class="rightDir" title="" href="javascript:void(0);" onclick="textSelection2('[tag:item:image][xx*xx]', '');">[tag:item:image][width*height]</a></strong></td>
					</tr>						
					<tr>
						<td><strong><a class="rightDir" title="" href="javascript:void(0);" onclick="textSelection2('[tag:item:radio]', '');">[tag:item:radio]</a></strong></td>
					</tr>
	
					<tr>
						<td></td>
					</tr>			
		            <tr>
		                <td>{#GalleryTags#}</td>
		                <td>
					        |&nbsp;
					        <a href="javascript:void(0);" onclick="textSelection2('<ol>', '</ol>');"><strong>OL</strong></a>&nbsp;|&nbsp;
					        <a href="javascript:void(0);" onclick="textSelection2('<ul>', '</ul>');"><strong>UL</strong></a>&nbsp;|&nbsp;
					        <a href="javascript:void(0);" onclick="textSelection2('<li>', '</li>');"><strong>LI</strong></a>&nbsp;|&nbsp;
							<a href="javascript:void(0);" onclick="textSelection2('<p class=&quot;&quot;>', '</p>');"><strong>P</strong></a>&nbsp;|&nbsp;
							<a href="javascript:void(0);" onclick="textSelection2('<strong>', '</strong>');"><strong>B</strong></a>&nbsp;|&nbsp;
							<a href="javascript:void(0);" onclick="textSelection2('<em>', '</em>');"><strong>I</strong></a>&nbsp;|&nbsp;
							<a href="javascript:void(0);" onclick="textSelection2('<h1>', '</h1>');"><strong>H1</strong></a>&nbsp;|&nbsp;
							<a href="javascript:void(0);" onclick="textSelection2('<h2>', '</h2>');"><strong>H2</strong></a>&nbsp;|&nbsp;
							<a href="javascript:void(0);" onclick="textSelection2('<h3>', '</h3>');"><strong>H3</strong></a>&nbsp;|&nbsp;
							<a href="javascript:void(0);" onclick="textSelection2('<h4>', '</h4>');"><strong>H4</strong></a>&nbsp;|&nbsp;
							<a href="javascript:void(0);" onclick="textSelection2('<h5>', '</h5>');"><strong>H5</strong></a>&nbsp;|&nbsp;
							<a href="javascript:void(0);" onclick="textSelection2('<div class=&quot;&quot; id=&quot;&quot;>', '</div>');"><strong>DIV</strong></a>&nbsp;|&nbsp;
							<a href="javascript:void(0);" onclick="textSelection2('<a href=&quot;&quot; title=&quot;&quot;>', '</a>');"><strong>A</strong></a>&nbsp;|&nbsp;
							<a href="javascript:void(0);" onclick="textSelection2('<img src=&quot;&quot; alt=&quot;&quot; />', '');"><strong>IMG</strong></a>&nbsp;|&nbsp;
							<a href="javascript:void(0);" onclick="textSelection2('<span>', '</span>');"><strong>SPAN</strong></a>&nbsp;|&nbsp;
							<a href="javascript:void(0);" onclick="textSelection2('<pre>', '</pre>');"><strong>PRE</strong></a>&nbsp;|&nbsp;
							<a href="javascript:void(0);" onclick="textSelection2('<br />', '');"><strong>BR</strong></a>&nbsp;|&nbsp;
							<a href="javascript:void(0);" onclick="textSelection2('\t', '');"><strong>TAB</strong></a>&nbsp;|
		                 </td>
		            </tr>
		    		<tr>
		    			<td colspan="2">
		    				<input type="submit" class="basicBtn" value="{#ButtonSave#}" />
		    			</td>
		    		</tr>
		    </tbody>
			</table>
		</form>	
		
		
		
							{literal}
		    <script language="javascript">
		      var editor = CodeMirror.fromTextArea(document.getElementById("poll_script"), {
		        lineNumbers: true,
				lineWrapping: true,
		        matchBrackets: true,
		        mode: "application/x-httpd-php",
		        indentUnit: 4,
		        indentWithTabs: true,
		        enterMode: "keep",
		        tabMode: "shift",
		        onChange: function(){editor.save();},
				onCursorActivity: function() {
				  editor.setLineClass(hlLine, null, null);
				  hlLine = editor.setLineClass(editor.getCursor().line, null, "activeline");
				}
		      });
		      
			  var hlLine = editor.setLineClass(0, "activeline");
		
		      function getSelectedRange() {
		        return { from: editor.getCursor(true), to: editor.getCursor(false) };
		      }
		
		      function textSelection(startTag,endTag) {
		        var range = getSelectedRange();
		        editor.replaceRange(startTag + editor.getRange(range.from, range.to) + endTag, range.from, range.to)
		        editor.setCursor(range.from.line, range.from.ch + startTag.length);
		      }
		
		      var editor2 = CodeMirror.fromTextArea(document.getElementById("poll_items"), {
		        lineNumbers: true,
				lineWrapping: true,
		        matchBrackets: true,
		        mode: "application/x-httpd-php",
		        indentUnit: 4,
		        indentWithTabs: true,
		        enterMode: "keep",
		        tabMode: "shift",
		        onChange: function(){editor2.save();},
				onCursorActivity: function() {
				  editor2.setLineClass(hlLine, null, null);
				  hlLine = editor2.setLineClass(editor2.getCursor().line, null, "activeline");
				}
		      });
		
		      function getSelectedRange2() {
		        return { from: editor2.getCursor(true), to: editor2.getCursor(false) };
		      }
		
		      function textSelection2(startTag,endTag) {
		        var range = getSelectedRange2();
		        editor2.replaceRange(startTag + editor2.getRange(range.from, range.to) + endTag, range.from, range.to)
		        editor2.setCursor(range.from.line, range.from.ch + startTag.length);
		      }
		
		      var hlLine = editor2.setLineClass(0, "activeline");
		      
		    </script>
		{/literal}
		
		
		
		</div>		
		
		
		
		
		
		
	</div>	
	<div class="fix"></div>
</div>



		
		
		<script src="/modules/poll/js/iColorPicker.js" type="text/javascript"></script>
	
		